﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Baskate : MonoBehaviour
{
    private Rigidbody rig;
    public float speed = 50f;
    private int score;
    private void Start()
    {
        rig = GetComponent<Rigidbody>();
    }
    private void Update()
    {
        rig.velocity = Vector3.right * Input.GetAxis("Horizontal") * speed;
    }

    private void OnCollisionEnter(Collision collision)
    {
        if (collision.collider.name.StartsWith("Egg"))
        {
            score++;
            Destroy(collision.gameObject);
        }
    }
    private void OnGUI()
    {
        GUILayout.Label(score.ToString("000"));
    }
}